package com.supermap.dataservice.user.dao;

import com.supermap.dataservice.entity.UserMenu;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author xiaolu
 * @date 2018/7/9 上午10:31
 */
@Mapper
public interface UserMenuMapper {

    /**
     * 根据用户ID查找菜单
     *
     * @param id 用户唯一性标示
     * @return
     */
    @Select("SELECT * FROM user_menu WHERE userCode=#{id};")
    @Results({
            @Result(id = true, property = "id", column = "id"),
            @Result(property = "userId", column = "userCode"),
            @Result(property = "menu", column = "menuId",
                    one = @One(select = "com.supermap.dataservice.mysql.mapper.MenuMapper.findMenuById"))
    })
    List<UserMenu> findUserMenuByUserId(@Param("id") String id);
}
